" add the calendar tag file to the tag search stack
set tags^=~/Outlines/outline_calendar/vo_calendar_tags.tag

" open the calendar at date
" a:1 is executed before the jump
function ToDate(date, ...)
    let l:precmd = a:0>0 ? a:1 : ""
    exec l:precmd
    exec "tag " . a:date . "|normal zO"
endfunction 

" open the calendar at a requested date
" default is today
" a:1 is executed before the jump
function ToSomeDay(...)
    let l:precmd = a:0>0 ? a:1 : ""
    let l:today = strftime("%Y-%m-%d") 
    let l:date = input('Date To Goto (yyyy-mm-dd): ', today) 
    call ToDate(l:date, l:precmd)
endfunction

" small case jumps use same window
nmap <leader>td :call ToDate(strftime("%Y-%m-%d"))<cr>
nmap <leader>ts :call ToSomeDay()<cr>
nmap <leader>tc :call ToDate(expand("<cWORD>"))<cr>

" upper case jumps open new window
nmap <leader>tD :call ToDate(strftime("%Y-%m-%d"),"new")<cr>
nmap <leader>tS :call ToSomeDay("new")<cr>
nmap <leader>tC :call ToDate(expand("<cWORD>"),"new")<cr>

